package com.lei.baselibrary.base.rx

import com.lei.baselibrary.base.presenter.view.BaseView
import rx.Subscriber
import java.util.concurrent.Flow

/**
 * @ProjectName : MyMall
 * @Author : 雷金泷
 * @Time : 2021/2/25 11:36
 * @Description : 文件描述
 */
//Rx 订阅者的默认实现
class BaseSubScribe<T>(val baseView: BaseView): Subscriber<T>() {
    override fun onNext(t: T) {
        //访问回来所拿到的数据
    }

    override fun onCompleted() {
        baseView.hideLoading()
    }

    override fun onError(e: Throwable?) {
        baseView.hideLoading()
        if (e is BaseException){
            baseView.onError(e.msg)
        }
    }
}